package com.nbsaas.boot.common.rest.resource;

import com.nbsaas.boot.common.api.apis.IpVisitApi;
import com.nbsaas.boot.common.data.entity.IpVisit;
import com.nbsaas.boot.common.api.domain.request.IpVisitRequest;
import com.nbsaas.boot.common.api.domain.response.IpVisitResponse;
import com.nbsaas.boot.common.api.domain.simple.IpVisitSimple;
import com.nbsaas.boot.common.rest.convert.IpVisitSimpleConvert;
import com.nbsaas.boot.common.rest.convert.IpVisitEntityConvert;
import com.nbsaas.boot.common.rest.convert.IpVisitResponseConvert;
import com.nbsaas.boot.common.data.repository.IpVisitRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   -业务接口实现
*/
@Transactional
@Service
public class IpVisitResource extends BaseResource<IpVisit,IpVisitResponse, IpVisitSimple, IpVisitRequest>  implements IpVisitApi {

    @Resource
    private IpVisitRepository ipVisitRepository;

    @Override
    public JpaRepositoryImplementation<IpVisit, Serializable> getJpaRepository() {
        return ipVisitRepository;
    }

    @Override
    public Function<IpVisit, IpVisitSimple> getConvertSimple() {
        return new IpVisitSimpleConvert();
    }

    @Override
    public Function<IpVisitRequest, IpVisit> getConvertForm() {
        return new IpVisitEntityConvert();
    }

    @Override
    public Function<IpVisit, IpVisitResponse> getConvertResponse() {
        return new IpVisitResponseConvert();
    }




}


